<template>
  <iframe id="frame" ref="frame" :src="url" @load="load"></iframe>
</template>
<script>
import { mapGetters } from 'vuex'
export default {
  name: 'other',
  created () {
    if (Object.keys(this.$route.query).length === 3) {
      let { source_app, user_id, idfa } = this.$route.query
      this.$store.dispatch('global/setInfo', {source_app, user_id, idfa})
    }
    // google统计
    window.ga && window.ga('send', 'event', this.appname, '进入', '飞豹')
  },
  computed: {
    ...mapGetters({
      appname: 'global/appname'
    })
  },
  data () {
    return {
      url: 'http://m.feibaodai.com.cn/fBExtend/?chlNo=jiujiuzhangshang&linkNo=10368#/'
    }
  },
  methods: {
    load () {
      let interval = setInterval(() => {
        if (document.activeElement.tagName === 'IFRAME') {
          clearInterval(interval)
          // google统计
          window.ga && window.ga('send', 'event', this.appname, '点击', '飞豹')
        }
      }, 1000)
    }
  }
}
</script>
<style lang="scss" scoped>
iframe {
  width: 100vw;
  height: 100vh;
  border: none;
}
</style>

